<!DOCTYPE html><!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--><!--[if gt IE 8]><!--><html class="no-js" lang="en"><!--<![endif]--><head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title></title>
  

  
  <link href="https://fonts.googleapis.com/css?family=Lato:400,700|Roboto+Slab:400,700|Inconsolata:400,700" rel="stylesheet" type="text/css">

  <link rel="stylesheet" href="/v2/css/theme.css" type="text/css">
  <link href="/v2/css/custom.css" rel="stylesheet">

  <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
  <script src="//cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.min.js"></script>
  <script src="../../js/theme.js"></script>
  <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/highlight.min.js"></script>
  <script src="../../search/main.js"></script>

  <style>
    body {font-size: 90%;}
    pre, code {font-size: 100%;}
    h3, h4, h5, h6 {color: #2980b9; font-weight: 300}
  </style> 
<meta name="robots" content="noindex"></head>

<body class="wy-body-for-nav" role="document">

  <div class="wy-grid-for-nav">

    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side stickynav">
      <div class="wy-side-nav-search">
        <a href="/v2/" class="icon icon-home"> </a>
        <div role="search">
  <form id="rtd-search-form" class="wy-form" action="" method="get">
    <input type="text" name="q" placeholder="Search docs">
    <input type="hidden" name="check_keywords" value="yes">
    <input type="hidden" name="area" value="default">
  </form>
</div>
      </div>

      <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
      <ul class="current">
   
  <span class="toctree-l0">Home</span>
  
  <li class="toctree-l1 ">
    <a class="" href="/v2/">Welcome</a>
    
  </li>
  
  <li class="toctree-l1 ">
    <a class="" href="/v2/imprint/">Imprint</a>
    
  </li>
     
  <span class="toctree-l0">Articles</span>
  
  <li class="toctree-l1 ">
    <a class="" href="/v2/articles/getting-started/">Getting started</a>
    
  </li>
  
  <li class="toctree-l1 ">
    <a class="" href="/v2/articles/heroku/">Heroku</a>
    
  </li>
  
  <li class="toctree-l1 ">
    <a class="" href="/v2/articles/express/">Usage with Express.JS</a>
    
  </li>
     
  <span class="toctree-l0">Docs</span>
  
  <li class="toctree-l1 ">
    <a class="" href="/v2/docs/installation/">Installation</a>
    
  </li>
  
  <li class="toctree-l1 ">
    <a class="" href="/v2/docs/usage/">Usage</a>
    
  </li>
  
  <li class="toctree-l1 ">
    <a class="" href="/v2/docs/promises/">Promises</a>
    
  </li>
  
  <li class="toctree-l1 ">
    <a class="" href="/v2/docs/models/">Models</a>
    
  </li>
  
  <li class="toctree-l1 ">
    <a class="" href="/v2/docs/instances/">Instances</a>
    
  </li>
  
  <li class="toctree-l1 ">
    <a class="" href="/v2/docs/associations/">Associations</a>
    
  </li>
  
  <li class="toctree-l1 ">
    <a class="" href="/v2/docs/hooks/">Hooks</a>
    
  </li>
  
  <li class="toctree-l1 ">
    <a class="" href="/v2/docs/transactions/">Transactions</a>
    
  </li>
  
  <li class="toctree-l1 ">
    <a class="" href="/v2/docs/migrations/">Migrations</a>
    
  </li>
  
  <li class="toctree-l1 ">
    <a class="" href="/v2/docs/misc/">Misc</a>
    
  </li>
     
  <span class="toctree-l0">API</span>
  
  <li class="toctree-l1 ">
    <a class="" href="/v2/api/sequelize/">Sequelize</a>
    
  </li>
  
  <li class="toctree-l1 ">
    <a class="" href="/v2/api/model/">Model</a>
    
  </li>
  
  <li class="toctree-l1 ">
    <a class="" href="/v2/api/instance/">Instance</a>
    
  </li>
  
  <li class="toctree-l1 ">
    <a class="" href="/v2/api/associations/">Associations</a>
    
  </li>
  
  <li class="toctree-l1 ">
    <a class="" href="/v2/api/hooks/">Hooks</a>
    
  </li>
  
  <li class="toctree-l1 ">
    <a class="" href="/v2/api/promise/">Promise</a>
    
  </li>
  
  <li class="toctree-l1 ">
    <a class="" href="/v2/api/transaction/">Transaction</a>
    
  </li>
  
  <li class="toctree-l1 ">
    <a class="" href="/v2/api/datatypes/">Datatypes</a>
    
  </li>
  
  <li class="toctree-l1 current">
    <a class="current" href="/v2/api/errors/">Errors</a>
    
    <ul>
      
    </ul>
    
  </li>
    
</ul>
      </div>
      &nbsp;
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
        <i data-toggle="wy-nav-top" class="icon icon-reorder"></i>
        <a href="/v2/"></a>
      </nav>

      
      <div class="wy-nav-content">
        <div class="rst-content">
          <div role="navigation" aria-label="breadcrumbs navigation">
  <ul class="wy-breadcrumbs">
    <li><a href="/v2/">Docs</a> »</li>
    <li>Errors</li>
      <li class="wy-breadcrumbs-aside">
        
      </li>
  </ul>
  <hr>
</div>
          <div role="main">
            <div class="section">
              <p><a name="errors"></a></p>
<h1 id="class-errors">Class Errors</h1>
<p><a href="https://github.com/sequelize/sequelize/blob/5aa77fa291abeaf0498f65724000c75da9ab9028/lib/errors.js#L11">View code</a>
Sequelize provides a host of custom error classes, to allow you to do easier debugging. All of these errors are exposed on the sequelize object and the sequelize constructor.
All sequelize errors inherit from the base JS error object.</p>
<hr>
<p><a name="baseerror"></a></p>
<h2 id="new-baseerror"><code>new BaseError()</code></h2>
<p><a href="https://github.com/sequelize/sequelize/blob/5aa77fa291abeaf0498f65724000c75da9ab9028/lib/errors.js#L20">View code</a>
The Base Error all Sequelize Errors inherit from.</p>
<p><strong>Aliases:</strong> Error</p>
<hr>
<p><a name="validationerror"></a></p>
<h2 id="new-validationerrormessage-errors"><code>new ValidationError(message, [errors])</code></h2>
<p><a href="https://github.com/sequelize/sequelize/blob/5aa77fa291abeaf0498f65724000c75da9ab9028/lib/errors.js#L40">View code</a>
Validation Error. Thrown when the sequelize validation has failed. The error contains an <code>errors</code> property,
which is an array with 1 or more ValidationErrorItems, one for each validation that failed.</p>
<p><strong>Params:</strong></p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>message</td>
<td>string</td>
<td>Error message</td>
</tr>
<tr>
<td>[errors]</td>
<td>Array</td>
<td>Array of ValidationErrorItem objects describing the validation errors</td>
</tr>
</tbody>
</table>
<p><strong>Extends:</strong> BaseError</p>
<hr>
<p><a name="get"></a></p>
<h2 id="getpath"><code>get(path)</code></h2>
<p><a href="https://github.com/sequelize/sequelize/blob/5aa77fa291abeaf0498f65724000c75da9ab9028/lib/errors.js#L53">View code</a>
Gets all validation error items for the path / field specified.</p>
<p><strong>Params:</strong></p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>path</td>
<td>string</td>
<td>The path to be checked for error items</td>
</tr>
</tbody>
</table>
<hr>
<p><a name="errors"></a></p>
<h2 id="errors"><code>errors()</code></h2>
<p><a href="https://github.com/sequelize/sequelize/blob/5aa77fa291abeaf0498f65724000c75da9ab9028/lib/errors.js#L67">View code</a>
An array of ValidationErrorItems</p>
<hr>
<p><a name="databaseerror"></a></p>
<h2 id="new-databaseerror"><code>new DatabaseError()</code></h2>
<p><a href="https://github.com/sequelize/sequelize/blob/5aa77fa291abeaf0498f65724000c75da9ab9028/lib/errors.js#L74">View code</a>
A base class for all database related errors.</p>
<p><strong>Extends:</strong> BaseError</p>
<hr>
<p><a name="parent"></a></p>
<h2 id="parent"><code>parent()</code></h2>
<p><a href="https://github.com/sequelize/sequelize/blob/5aa77fa291abeaf0498f65724000c75da9ab9028/lib/errors.js#L88">View code</a>
The database specific error which triggered this one</p>
<hr>
<p><a name="sql"></a></p>
<h2 id="sql"><code>sql()</code></h2>
<p><a href="https://github.com/sequelize/sequelize/blob/5aa77fa291abeaf0498f65724000c75da9ab9028/lib/errors.js#L94">View code</a>
The SQL that triggered the error</p>
<hr>
<p><a name="timeouterror"></a></p>
<h2 id="new-timeouterror"><code>new TimeoutError()</code></h2>
<p><a href="https://github.com/sequelize/sequelize/blob/5aa77fa291abeaf0498f65724000c75da9ab9028/lib/errors.js#L101">View code</a>
Thrown when a database query times out because of a deadlock</p>
<p><strong>Extends:</strong> DatabaseError</p>
<hr>
<p><a name="uniqueconstrainterror"></a></p>
<h2 id="new-uniqueconstrainterror"><code>new UniqueConstraintError()</code></h2>
<p><a href="https://github.com/sequelize/sequelize/blob/5aa77fa291abeaf0498f65724000c75da9ab9028/lib/errors.js#L112">View code</a>
Thrown when a unique constraint is violated in the database</p>
<p><strong>Extends:</strong> DatabaseError</p>
<hr>
<p><a name="foreignkeyconstrainterror"></a></p>
<h2 id="new-foreignkeyconstrainterror"><code>new ForeignKeyConstraintError()</code></h2>
<p><a href="https://github.com/sequelize/sequelize/blob/5aa77fa291abeaf0498f65724000c75da9ab9028/lib/errors.js#L131">View code</a>
Thrown when a foreign key constraint is violated in the database</p>
<p><strong>Extends:</strong> DatabaseError</p>
<hr>
<p><a name="message"></a></p>
<h2 id="message"><code>message()</code></h2>
<p><a href="https://github.com/sequelize/sequelize/blob/5aa77fa291abeaf0498f65724000c75da9ab9028/lib/errors.js#L151">View code</a>
The message from the DB.</p>
<hr>
<p><a name="fields"></a></p>
<h2 id="fields"><code>fields()</code></h2>
<p><a href="https://github.com/sequelize/sequelize/blob/5aa77fa291abeaf0498f65724000c75da9ab9028/lib/errors.js#L157">View code</a>
The fields of the unique constraint</p>
<hr>
<p><a name="value"></a></p>
<h2 id="value"><code>value()</code></h2>
<p><a href="https://github.com/sequelize/sequelize/blob/5aa77fa291abeaf0498f65724000c75da9ab9028/lib/errors.js#L163">View code</a>
The value(s) which triggered the error</p>
<hr>
<p><a name="index"></a></p>
<h2 id="index"><code>index()</code></h2>
<p><a href="https://github.com/sequelize/sequelize/blob/5aa77fa291abeaf0498f65724000c75da9ab9028/lib/errors.js#L169">View code</a>
The name of the index that triggered the error</p>
<hr>
<p><a name="validationerroritem"></a></p>
<h2 id="new-validationerroritemmessage-type-path-value"><code>new ValidationErrorItem(message, type, path, value)</code></h2>
<p><a href="https://github.com/sequelize/sequelize/blob/5aa77fa291abeaf0498f65724000c75da9ab9028/lib/errors.js#L181">View code</a>
Validation Error Item
Instances of this class are included in the <code>ValidationError.errors</code> property.</p>
<p><strong>Params:</strong></p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>message</td>
<td>string</td>
<td>An error message</td>
</tr>
<tr>
<td>type</td>
<td>string</td>
<td>The type of the validation error</td>
</tr>
<tr>
<td>path</td>
<td>string</td>
<td>The field that triggered the validation error</td>
</tr>
<tr>
<td>value</td>
<td>string</td>
<td>The value that generated the error</td>
</tr>
</tbody>
</table>
<hr>
<p><em>This document is automatically generated based on source code comments. Please do not edit it directly, as your changes will be ignored. Please write on <a href="/v2/irc://irc.freenode.net/#sequelizejs">IRC</a>, open an issue or a create a pull request if you feel something can be improved. For help on how to write source code documentation see <a href="http://usejsdoc.org">JSDoc</a> and <a href="https://github.com/tj/dox">dox</a></em></p>
            </div>
          </div> 
          <footer>
  

  <hr>

  <div role="contentinfo">
    <p>
    <!-- Copyright etc -->
    </p>
  </div>

  Built with <a href="http://www.mkdocs.org">MkDocs</a>, using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
	  
        </div>
      </div>

    </section>

  </div>

<div class="rst-versions" role="note" style="cursor: pointer">
    <span class="rst-current-version" data-toggle="rst-current-version">
        
      <span><a href="/v2/" style="color: #fcfcfc;">« Previous</a></span>
      <span style="margin-left: 15px"><a href="/v2/" style="color: #fcfcfc">Next »</a></span>
    </span>
</div>

</body></html>